/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author ODHeroes
 */
@Entity
@Table(name = "product_brands")
@NamedQueries({
    @NamedQuery(name = "ProductBrands.findAll", query = "SELECT p FROM ProductBrands p"),
    @NamedQuery(name = "ProductBrands.findByCreatedAt", query = "SELECT p FROM ProductBrands p WHERE p.createdAt = :createdAt"),
    @NamedQuery(name = "ProductBrands.findByProdcutsBrandsId", query = "SELECT p FROM ProductBrands p WHERE p.prodcutsBrandsId = :prodcutsBrandsId"),
    @NamedQuery(name = "ProductBrands.findByName", query = "SELECT p FROM ProductBrands p WHERE p.name = :name"),
    @NamedQuery(name = "ProductBrands.findByUpdatedAt", query = "SELECT p FROM ProductBrands p WHERE p.updatedAt = :updatedAt")})
public class ProductBrands implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "created_at")
    @Temporal(TemporalType.DATE)
    private Date createdAt;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "prodcuts_brands_id")
    private BigDecimal prodcutsBrandsId;
    @Size(max = 256)
    @Column(name = "name")
    private String name;
    @Column(name = "updated_at")
    @Temporal(TemporalType.DATE)
    private Date updatedAt;
    @ManyToMany(mappedBy = "productBrandsCollection")
    private Collection<Products> productsCollection;

    public ProductBrands() {
    }

    public ProductBrands(BigDecimal prodcutsBrandsId) {
        this.prodcutsBrandsId = prodcutsBrandsId;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public BigDecimal getProdcutsBrandsId() {
        return prodcutsBrandsId;
    }

    public void setProdcutsBrandsId(BigDecimal prodcutsBrandsId) {
        this.prodcutsBrandsId = prodcutsBrandsId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Collection<Products> getProductsCollection() {
        return productsCollection;
    }

    public void setProductsCollection(Collection<Products> productsCollection) {
        this.productsCollection = productsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (prodcutsBrandsId != null ? prodcutsBrandsId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProductBrands)) {
            return false;
        }
        ProductBrands other = (ProductBrands) object;
        if ((this.prodcutsBrandsId == null && other.prodcutsBrandsId != null) || (this.prodcutsBrandsId != null && !this.prodcutsBrandsId.equals(other.prodcutsBrandsId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Model.ProductBrands[ prodcutsBrandsId=" + prodcutsBrandsId + " ]";
    }
    
}
